<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <title>服务器监控</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <!-- basic styles -->
    <div th:replace="common/header::header"></div>
    <link rel="stylesheet" href="/static/css/ry-ui.css"/>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="col-sm-12">
        <div class="row">
            <div class="col-sm-6">
                <div class="ibox float-e-margins">
                    <div class="ibox-title widget-header header-color-blue">
                        <h5>CPU</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link"><i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="close-link"><i class="fa fa-times"></i></a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-striped table-bordered table-hover">
                            <thead>
                            <tr>
                                <th>属性</th>
                                <th>值</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td>核心数</td>
                                <td th:text="${server.cpu.cpuNum}">0个</td>
                            </tr>
                            <tr>
                                <td>用户使用率</td>
                                <td th:text="${server.cpu.used + '%'}">0%</td>
                            </tr>
                            <tr>
                                <td>系统使用率</td>
                                <td th:text="${server.cpu.sys + '%'}">0%</td>
                            </tr>
                            <tr>
                                <td>当前空闲率</td>
                                <td th:text="${server.cpu.free + '%'}">0%</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

            <div class="col-sm-6">
                <div class="ibox float-e-margins">
                    <div class="ibox-title widget-header header-color-blue">
                        <h5>内存</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                            <a class="close-link"><i class="fa fa-times"></i></a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-hover no-margins">
                            <thead>
                            <tr>
                                <th>属性</th>
                                <th>内存</th>
                                <th>JVM</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td>总内存</td>
                                <td th:text="${server.mem.total + 'G'}">0GB</td>
                                <td th:text="${server.jvm.total + 'M'}">0MB</td>
                            </tr>
                            <tr>
                                <td>已用内存</td>
                                <td th:text="${server.mem.used + 'G'}">0GB</td>
                                <td th:text="${server.jvm.used + 'M'}">0MB</td>
                            </tr>
                            <tr>
                                <td>剩余内存</td>
                                <td th:text="${server.mem.free + 'G'}">0GB</td>
                                <td th:text="${server.jvm.free + 'M'}">0MB</td>
                            </tr>
                            <tr>
                                <td>使用率</td>
                                <td th:class="${server.mem.usage gt 80} ? 'text-danger'">[[${server.mem.usage}]]%</td>
                                <td th:class="${server.jvm.usage gt 80} ? 'text-danger'">[[${server.jvm.usage}]]%</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title widget-header header-color-blue">
                        <h5>服务器信息</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-sm-12">
                                <table class="table table-hover margin bottom">
                                    <tbody>
                                    <tr>
                                        <td>服务器名称</td>
                                        <td th:text="${server.sys.computerName}">RuoYi</td>
                                        <td>操作系统</td>
                                        <td th:text="${server.sys.osName}">Linux</td>
                                    </tr>
                                    <tr>
                                        <td>服务器IP</td>
                                        <td th:text="${server.sys.computerIp}">127.0.0.1</td>
                                        <td>系统架构</td>
                                        <td th:text="${server.sys.osArch}">amd64</td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title widget-header header-color-blue">
                        <h5>Java虚拟机信息</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">

                        <div class="row">
                            <div class="col-sm-12 ">
                                <table class="table table-striped table-bordered table-hover">
                                    <tbody>
                                    <tr>
                                        <td>Java名称</td>
                                        <td th:text="${server.jvm.name}">Java</td>
                                        <td>Java版本</td>
                                        <td th:text="${server.jvm.version}">1.8.0</td>
                                    </tr>
                                    <tr>
                                        <td>启动时间</td>
                                        <td th:text="${server.jvm.startTime}">2018-12-31 00:00:00</td>
                                        <td>运行时长</td>
                                        <td th:text="${server.jvm.runTime}">0天0时0分0秒</td>
                                    </tr>
                                    <tr>
                                        <td colspan="1">安装路径</td>
                                        <td colspan="3" th:text="${server.jvm.home}"></td>
                                    </tr>
                                    <tr>
                                        <td colspan="1">项目路径</td>
                                        <td colspan="3" th:text="${server.sys.userDir}"></td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title widget-header header-color-blue">
                        <h5>磁盘状态</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">

                        <div class="row">
                            <div class="col-sm-12">
                                <table class="table table-hover margin bottom">
                                    <thead>
                                    <tr>
                                        <th>盘符路径</th>
                                        <th>文件系统</th>
                                        <th>盘符类型</th>
                                        <th>总大小</th>
                                        <th>可用大小</th>
                                        <th>已用大小</th>
                                        <th>已用百分比</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr th:each="sysFile : ${server.sysFiles}">
                                        <td th:text="${sysFile.dirName}">C:\</td>
                                        <td th:text="${sysFile.sysTypeName}">NTFS</td>
                                        <td th:text="${sysFile.typeName}">local</td>
                                        <td th:text="${sysFile.total}">0GB</td>
                                        <td th:text="${sysFile.free}">0GB</td>
                                        <td th:text="${sysFile.used}">0GB</td>
                                        <td th:class="${sysFile.usage gt 80} ? 'text-danger'">[[${sysFile.usage}]]%</td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title widget-header header-color-blue">
                        <h5>数据库信息(Show VARIABLES)</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-sm-12">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                    <th class="col-sm-2"><b>参数</b></th>
                                    <th class="col-sm-2">值</th>
                                    <th class="col-sm-8">说明</th>
                                    </thead>
                                    <tbody>
                                    <tr>
                                        <td><b>数据库位置</b></td>
                                        <td th:text="${variableMap['basedir']}">0</td>
                                        <td>数据库base目录</td>
                                    </tr>
                                    <tr>
                                        <td class=><b>最大连接数(max_connections)</b></td>
                                        <td class=th:text="${variableMap['max_connections']}">0</td>
                                        <td class=>同时处理最大连接数，推荐设置最大连接数是上限连接数的80%左右</td>
                                    </tr>
                                    <tr>
                                        <td><b>查询排序时缓冲区大小(MB)(sort_buffer_size)</b></td>
                                        <td th:text="${variableMap['sort_buffer_size']}/1024/1024 + ' MB'">0
                                        </td>
                                        <td>查询排序时缓冲区大小，只对order by和group by起作用，可增大此值为16M</td>
                                    </tr>
                                    <tr>
                                        <td><b>打开文件数限制(open_files_limit)</b></td>
                                        <td th:text="${variableMap['open_files_limit']}">0</td>
                                        <td>打开文件数限制，如果show global status like
                                            'open_files'查看的值等于或者大于open_files_limit值时，程序会无法连接数据库或卡死
                                        </td>
                                    </tr>
                                    <tr>
                                        <td><b>缓冲池总大小(MB)</b></td>
                                        <td th:text="(${variableMap['innodb_buffer_pool_chunk_size']}/1024/1024*${variableMap['innodb_buffer_pool_instances'] }) + ' MB'">
                                            0
                                        </td>
                                        <td>
                                            (InnoDB)索引和数据缓冲区大小，一般设置物理内存的60%-70%(innodb_buffer_pool_chunk_size *
                                            innodb_buffer_pool_instances)
                                        </td>
                                    </tr>
                                    <tr>
                                        <td><b>缓冲池个数(innodb_buffer_pool_instances)</b></td>
                                        <td th:text="${variableMap['innodb_buffer_pool_instances']}">
                                            0
                                        </td>
                                        <td>(InnoDB)缓冲池实例个数，推荐设置4个或8个</td>
                                    </tr>
                                    <tr>
                                        <td><b>日志并同步类型(innodb_flush_log_at_trx_commit)</b></td>
                                        <td th:text="${variableMap['innodb_flush_log_at_trx_commit']}">
                                            0
                                        </td>
                                        <td>
                                            (InnoDB)关键参数，0代表大约每秒写入到日志并同步到磁盘，数据库故障会丢失1秒左右事务数据。1为每执行一条SQL后写入到日志并同步到磁盘，I/O开销大，执行完SQL要等待日志读写，效率低。2代表只把日志写入到系统缓存区，再每秒同步到磁盘，效率很高，如果服务器故障，才会丢失事务数据。对数据安全性要求不是很高的推荐设置2，性能高，修改后效果明显。
                                        </td>
                                    </tr>
                                    <tr>
                                        <td><b>独立表空间模式(innodb_file_per_table)</b></td>
                                        <td th:text="${variableMap['innodb_file_per_table']}">0</td>
                                        <td>
                                            (InnoDB)默认是共享表空间，共享表空间idbdata文件不断增大，影响一定的I/O性能。推荐开启独立表空间模式，每个表的索引和数据都存在自己独立的表空间中，可以实现单表在不同数据库中移动。
                                        </td>
                                    </tr>
                                    <tr>
                                        <td><b>日志缓冲区大小(innodb_log_buffer_size)</b></td>
                                        <td th:text="(${variableMap['innodb_log_buffer_size']}/1024/1024) + ' MB'">0</td>
                                        <td>(InnoDB)日志缓冲区大小，由于日志最长每秒钟刷新一次，所以一般不用超过16M</td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title widget-header header-color-blue">
                        <h5>数据库信息(Show status)</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-sm-12">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                    <th class="col-sm-2"><b>参数</b></th>
                                    <th class="col-sm-2">值</th>
                                    <th class="col-sm-8">说明</th>
                                    </thead>
                                    <tbody>
                                    <!--                                        <tr>-->

                                    <!--                                            <td class="col-sm-2" ><b>创建的线程</b></td>-->
                                    <!--                                            <td class="col-sm-1" th:text="${statusMap['Threads_created']}">0</td>-->
                                    <!--                                            <td class="col-sm-2"><b>连接的线程</b></td>-->
                                    <!--                                            <td class="col-sm-1" th:text="${statusMap['Threads_connected']}">0</td>-->
                                    <!--                                            <td class="col-sm-2"><b>运行的线程</b></td>-->
                                    <!--                                            <td class="col-sm-1" th:text="${statusMap['Threads_running']}">0</td>-->
                                    <!--                                            <td class="col-sm-2" ><b>缓存的线程</b></td>-->
                                    <!--                                            <td class="col-sm-1" th:text="${statusMap['Threads_cached']}">0</td>-->
                                    <!--                                        </tr>-->
                                    <tr>
                                        <td class="col-sm-2"><b>创建的线程(Threads_created)</b></td>
                                        <td class="col-sm-1" th:text="${statusMap['Threads_created']}">0</td>
                                        <td class="col-sm-9">Threads_created</td>
                                    </tr>
                                    <tr>
                                        <td class="col-sm-2"><b>连接的线程(Threads_connected)</b></td>
                                        <td class="col-sm-1" th:text="${statusMap['Threads_connected']}">0</td>
                                        <td class="col-sm-9">Threads_connected</td>
                                    </tr>
                                    <tr>
                                        <td class="col-sm-2"><b>Questions</b></td>
                                        <td class="col-sm-1" th:text="${statusMap['Questions']}">0</td>
                                        <td class="col-sm-9">内部计数器（根据 MySQL 用语，这是一个服务器状态变量），客户端每发送一个查询语句，其值就会加一。由
                                            Questions 指标带来的以客户端为中心的视角常常比相关的 Queries
                                            计数器更容易解释。作为存储程序的一部分，后者也会计算已执行语句的数量，以及诸如 PREPARE 和 DEALLOCATE PREPARE
                                            指令运行的次数，作为服务器端预处理语句的一部分。
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="col-sm-2"><b>缓冲池使用率</b></td>
                                        <td class="col-sm-1"
                                            th:text="(1 - ${statusMap['Innodb_buffer_pool_pages_free']}/${statusMap['Innodb_buffer_pool_pages_total']})*100 + '%' "></td>
                                        <td class="col-sm-9">缓冲池使用率,(1 -
                                            Innodb_buffer_pool_pages_free/Innodb_buffer_pool_pages_total)*100%
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<!--<th:block th:include="include :: footer" />-->
<!--<script>-->
<!--    $(".modal").appendTo("body"), $("[data-toggle=popover]").popover(), $(".collapse-link").click(function() {-->
<!--        var div_ibox = $(this).closest("div.ibox"),-->
<!--        e = $(this).find("i"),-->
<!--        i = div_ibox.find("div.ibox-content");-->
<!--        i.slideToggle(200),-->
<!--        e.toggleClass("fa-chevron-up").toggleClass("fa-chevron-down"),-->
<!--        div_ibox.toggleClass("").toggleClass("border-bottom"),-->
<!--        setTimeout(function() {-->
<!--        	div_ibox.resize();-->
<!--        }, 50);-->
<!--    }), $(".close-link").click(function () {-->
<!--		var div_ibox = $(this).closest("div.ibox");-->
<!--		div_ibox.remove()-->
<!--	});-->
<!--</script>-->
</html>
